<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title u-border-bottom">{{title}}</text>
		</view>
		<u-button type="primary" text="网络请求" @click="test"></u-button>
		<view>
			{{whitePageList}}
		</view>
		<u-button type="primary" text="store数据持久化" @click="test2"></u-button>
		<u-modal :show="show" :title="title" :content='content'></u-modal>
		<u-button @click="show = true" text="打开"></u-button>
	</view>
</template>

<script>
	import {
		getMenu,
		postMenu
	} from '@/util/http.api.js'
	import {
		mapActions,
		mapGetters
	} from 'vuex'

	export default {
		data() {
			return {
				show: false,
				title: '标题',
				content: 'uView的目标是成为uni-app生态最优秀的UI框架'
			}
		},
		computed: {
			...mapGetters(['whitePageList']),
			...mapGetters({
				tabBarNavList: 'app/tabBarNavList'
			})
		},
		onLoad() {
			console.log( // 返回类似/pages/example/components的结果
				uni.$u.page()
			)
		},
		methods: {
			...mapActions({
				actionTest: 'app/test'
			}),
			async test() {
				const re = await getMenu({
					params: {
						userName: 'name',
						password: '123456'
					}
				})
				// const re2 = await postMenu({a:1})
			},
			test2() {
				console.log(this.actionTest())
			}
		}
	}
</script>

<style lang="scss">
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
		background-color: $u-bg-color;
	}
</style>